#include "CCSkeletalAnimation.h"



CCSkeletalAnimation::CCSkeletalAnimation() :
		m_duration(0) {
}

CCSkeletalAnimation::~CCSkeletalAnimation() {
	for(TransformPtrList::iterator iter = m_transList.begin(); iter != m_transList.end(); iter++) {
		(*iter)->release();
	}
    m_transList.clear();
    for(EventPtrList::iterator iter = m_eventList.begin(); iter != m_eventList.end(); iter++) {
		(*iter)->release();
	}
    m_eventList.clear(); 
}

CCSkeletalAnimation* CCSkeletalAnimation::create() {
	CCSkeletalAnimation* a = new CCSkeletalAnimation();
	return (CCSkeletalAnimation*)a->autorelease();
}

void CCSkeletalAnimation::addTransform(CCTransform* t) {
	m_transList.push_back(t);
	t->retain();
}

void CCSkeletalAnimation::addEvent(EventData *data) {
    for(auto item : m_eventList) {
        if(strcmp(item->name, data->name) == 0) {
            data->release();
            return;
        }
    }

    m_eventList.push_back(data);
}


